import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-03-31
 * Time: 13:36
 */
public class Demo1 {
    public   static int count = 0;
    public static void main(String[] args) throws InterruptedException {
        Object locker = new Object();

          Thread t1=new Thread(()->{

                   while(count==0){
                       synchronized (locker){{

                       }}
                     }

              System.out.println("t1线程结束");
          });

          Thread t2=new Thread(()->{
              Scanner scanner=new Scanner(System.in);
              System.out.println("请输入一个整数:");
              count=scanner.nextInt();

          });
        t1.start();
        t2.start();
    }
}
